/**     
* @Title: UserService.java   
* @Package me.security.example.service   
* @Description: TODO   
* @author xaoyaoyao
* @date 2017年8月23日 下午1:45:54
*/
package me.security.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

import me.security.example.dao.UserDao;
import me.security.example.domain.SysUser;
import me.security.example.utils.MD5Util;

/**
 * @ClassName: UserService
 * @Description: TODO
 * @author xaoyaoyao
 * @date 2017年8月23日 下午1:45:54
 * 
 */
@Service
public class UserService {
	
	@Autowired
	UserDao userDao;

	public SysUser create(SysUser sysUser) {
		// 进行加密
//		BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
//		sysUser.setPassword(encoder.encode(sysUser.getRawPassword().trim()));
		sysUser.setPassword(MD5Util.encode(sysUser.getRawPassword().trim()));
		userDao.create(sysUser);
		return sysUser;
	}

}